package Routes

import (
	"deepgox-go-admin/Pkg/Logger"
	"deepgox-go-admin/Routes/ManagerRouter"
	"deepgox-go-admin/Settings"
	"fmt"
	"runtime"

	_ "deepgox-go-admin/docs"
	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	gs "github.com/swaggo/gin-swagger"
	"net/http"
)

func Setup() *gin.Engine {
	r := gin.New()
	r.GET("/swagger/*any", gs.WrapHandler(swaggerFiles.Handler))
	r.Use(Logger.GinLogger(), Logger.GinRecovery(true))
	r.GET("/", func(c *gin.Context) {
		c.String(http.StatusOK, fmt.Sprintf("欢迎使用 DeepGoX 脚手架 \n 系统版本信息:%s\n Go版本信息:%s\n", Settings.Conf.Version, runtime.Version()))
	})
	//接口版本
	version := r.Group("/v1")
	//用户管理功能模块
	ManagerRouter.ManagerRouter(version)

	//r.POST("/v1/manager/login", ManagerService.LoginHandle)
	return r
}
